package com.demo.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import javax.jms.Topic;

/**
 * @author wangzhanjin
 * @date 2018/6/13 20:04
 *
 */
@Component
public class MqTopicService {
    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;
    @Autowired
    private Topic topic;
    public void send(String msg) {
        this.jmsMessagingTemplate.convertAndSend(this.topic, msg);
    }
}